<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>FH Admin</title>
    <!-- HTML5 Shim and Respond.js IE10 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 10]>
		<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
		<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
		<![endif]-->
    <!-- Meta -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="author" content="FH Admin QQ313596790" />
    
    <!--引入弹窗组件-->
    <link type="text/css" rel="stylesheet" href="fhdrag/style.css" />
	<!-- vue -->
	<script src="../assets/js/vue.js"></script>
</head>
<body>

	<div style="width:100%;" id="app">
	
		<img v-show="loading" src="../assets/images/loading.gif" />
		<iframe name="mainFrame" id="mainFrame" frameborder="0" v-bind:src="'fhadmin.html#/processes/'+fhadminId+'/fhadmin'" style="margin:0 auto;width:100%;height:350px;"></iframe>
		
	</div>

<script type="text/javascript" src="../assets/js/jquery-1.7.2.js"></script>

<!--引入弹窗组件start-->
<script type="text/javascript" src="fhdrag/drag.js"></script>
<script type="text/javascript" src="fhdrag/dialog.js"></script>
<!--引入弹窗组件end-->

<script type="text/javascript">

var vm = new Vue({
	el: '#app',
	
	data:{
		fhadminId: '',	//流程ID
		ID_: '',
		fhtype:	'',
		curl:	'',
		showf:false,
		loading:true
    },
    
    methods: {
    	//初始执行
        init() {
    		var fhadminId = this.getUrlKey('fhadminId');//链接参数
        	if(null != fhadminId){
        		this.fhadminId = fhadminId;
        		this.fhtype = fhadminId.substring(0, 8);
        		if(this.fhtype == "fhadmind"){
        			this.showf = false;
        		}else{
        			this.showf = true;
        		}
        	}
        	var ID_ = this.getUrlKey('ID_');//链接参数
        	if(null != ID_){
        		this.ID_ = ID_;
        	}
        	var curl = this.getUrlKey('curl');//链接参数
        	if(null != curl){
        		this.curl = curl.replace('ruprocdef_list.html','').replace('rutask_list.html','');
        	}
        },
        
        //跳转节点
        move: function(fhuser,nodeId,toNodeId,REASON){
        	var locat = (window.location+'').split('flwEditor')[0]; 
        	var PROC_INST_ID_ = this.fhadminId.replace('fhadminj','');
        	if("" == REASON)REASON = "未填写";
        	$.ajax({
        		xhrFields: {
                    withCredentials: true
                },
        		type: "POST",
        		url: locat+'ruprocdef/move',
        		data: {PROC_INST_ID_:PROC_INST_ID_,ID_:this.ID_,nodeId:nodeId,toNodeId:toNodeId,REASON:REASON,tm:new Date().getTime()},
        		dataType:"json",
        		success: function(data){
        		 if("success" == data.result){
        			 window.location.href = vm.curl+"../ruprocdef/ruprocdef_move.html?callback=ok&fhuser="+fhuser+"&PROC_INST_ID_="+PROC_INST_ID_;
        		 }else if ("exception" == data.result){
        			 alert("后台异常: "+data.exception);//显示异常
                 }
        		}
        	}).done().fail(function(){
                alert("登录失效!请求服务器无响应，稍后再试");
            });
        },
        
      	//浏览器窗口大小变化时调用
        cmainFrame: function(){
            var hmain = document.getElementById("mainFrame");
            var bheight = document.documentElement.clientHeight;
            hmain.style.width = '100%';
            hmain.style.height = (bheight-20) + 'px';
        },
        
      	//根据url参数名称获取参数值
        getUrlKey: function (name) {
            return decodeURIComponent(
                (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
        }
        
    },
    
	mounted(){
        this.init();
    }
})

//窗口大小变化事件
window.onresize=function(){  
	vm.cmainFrame();
};

</script>	
</body>
</html>